#! /bin/bash
#=================================================
#======== copy下面代码到脚本中使用日志功能  ======
#=================================================
logshExist=$(`ls ./log.sh &>/dev/null`; echo $?);			#日志脚本文件是否存在
downLoaded=0;								#是否下载过脚本文件,如果下载过,无论成功失败都不会再次下载.
if [ $logshExist -gt 0 -a  $downLoaded -eq 0 ]
  then
    wget -N http://gitee.com/topanda/note/raw/master/linux/log.sh &>/dev/null;		#下载日志脚本
    downLoaded=1;							#重置下载标记
fi
chmod u+x log.sh							#修改日志脚本执行权限
logshExist=$(`ls ./log.sh &>/dev/null`; echo $?);
function log(){								#如果不存在日志文件,默认什么都不做.
  if [  $logshExist -eq 0 ]
    then 
    logPath=$shellPath/log.sh
    $logPath $*; 
  fi
}
#================================================
#==========  日志脚本引用代码 END    ============
#================================================
#测试
log DEBUG  this is test
log INFO  this is test
log WARN  this is test
log ERR  this is test
log   this is testlog   this is test

